package com.wuye.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.wuye.common.dao.hibernate.BaseDaoHibernate;
import com.wuye.common.vo.CommonObjectVO;
import com.wuye.dao.VehicleDao;
import com.wuye.entity.Vehicle;
import com.wuye.mapper.CommonMapper;
import com.wuye.util.MyBatisSessionFactory;

@Repository("vehicleDao")
public class VehicleDaoImpl extends BaseDaoHibernate implements VehicleDao
{

	public List<CommonObjectVO> getVehicleInfo(int roomId) 
	{
		List<CommonObjectVO> vehicleInfo = null;
		SqlSession session = null;
		
		try 
		{
			session = MyBatisSessionFactory.getSession();			
			CommonMapper commonMapper = session.getMapper(CommonMapper.class);
			vehicleInfo = commonMapper.getVehicleInfo(roomId);
		}
		catch (Exception e) 
		{
			e.printStackTrace();
		}
		finally
		{
			session.close();
		}
		
		return vehicleInfo;
	}

	public Vehicle getVehicle(int vehicleId)
	{
		return (Vehicle)super.getObject(Vehicle.class, vehicleId);
	}

}
